
import urllib.request
import urllib.error

# url = 'https://blog.csdn.net/ityard/article/details/102807071'
# 人为写错1     except urllib.error.HTTPError:


#     print('系统正在升级。。。')
# url = 'https://blog.csdn.net/ityard/article/details/1028070719'


# 认为写错2
url = 'http://www.goudan11111111.com'


headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36'
}

try:
    request = urllib.request.Request(url=url, headers=headers)

    response = urllib.request.urlopen(request)

    content = response.read().decode('utf-8')

    print(content)

except urllib.error.HTTPError:
    print('系统正在升级。。。')

except urllib.error.URLError:
    print('都说了系统正在升级, 你咋这么倔呢。。。')
